package Action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import Dao.scheduledao;
import Entity.Room_ced;
import Entity.User;
import mapper.Schedulemapper;

/**
 * Servlet implementation class SsearchServlet
 */
@WebServlet("/SsearchServlet")
public class SsearchServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public SsearchServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("user");
		String id =user.getUid();
		Schedulemapper sm =new scheduledao();
		List<Room_ced> lr =sm.queryScheduleBycid(id);
		System.out.println(lr);
		request.setAttribute("courses_id", lr);
		request.getRequestDispatcher("s_check_class.jsp").forward(request,response);
	}

}
